package pailaidai.hc.com.mysvgdemo.view;

import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Shader;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

import pailaidai.hc.com.mysvgdemo.R;

/**
 * Created by Administrator on 2018/4/23.
 */

public class RadarView extends View {
    private Bitmap mIconScanBitmap;//默认扫描图标
    private Bitmap mIconScaningBitmap;//扫描是图标
    private Bitmap mScanBitmap;//白色扫描图
    private Bitmap mScanBackgroundBitmap;//黑色扫描背景
    private Rect mButtonArea = new Rect();//扫描按钮区域
    private Matrix mScaleMatrix = new Matrix();//缩放矩阵
    private Matrix mRotateMatrix = new Matrix();//旋转矩阵
    private ValueAnimator mRotateAnimator = new ValueAnimator();//扫描图标旋转动画
    private ValueAnimator mScaleMinAnimator = new ValueAnimator();//手指点击时白色扫描图片缩小动画
    private ValueAnimator mScaleMaxAnimator = new ValueAnimator();//手指放开时白色扫描图片放大动画
    private ValueAnimator mOutGrayAnimator = new ValueAnimator();//扫描波纹灰色线动画
    private ValueAnimator mInnerWhiteAnimator=new ValueAnimator();//扫描波纹白色动画
    private ValueAnimator mBlackAnimator=new ValueAnimator();//扫描波纹灰色动画
    //画笔
    private Paint mOutGrayPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
    private Paint mInnerWhitePaint=new Paint(Paint.ANTI_ALIAS_FLAG);
    private Paint mBlackPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
    private Paint mTextPaint=new Paint(Paint.ANTI_ALIAS_FLAG);
    //扫描图标旋转角度
    private float mRotateDegree;
    //缩放比例，默认1:1
    private float mScaleRatio=1;
    //设定自定义View半径
    private int mRadius;
    //扫描波纹灰色线半径
    private float mOutGrayRadius=0;
    //扫面波纹白色部分半径
    private float mInnerWhiteRadius=0;
    //扫描波纹灰色部分半径
    private float mBlackReadius=0;
    //默认扫描文字提示
    private String mTipText="点击雷达，开始探索";
    //测量扫描文字提示边界
    private Rect mTextBound=new Rect();
    //是否点击按钮，默认没有点击
    private boolean isButtonClick=false;
    public RadarView(Context context) {
        this(context,null);
    }

    public RadarView(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs,0);
    }

    public RadarView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        //加载图片
        mIconScanBitmap= BitmapFactory.decodeResource(getResources(), R.mipmap.icon_leidasaomiao);
        mIconScaningBitmap=BitmapFactory.decodeResource(getResources(),R.mipmap.radar_button_scan);



    }







}
